package com.example.wryproject.utils;

import ohos.eventhandler.EventHandler;
import ohos.eventhandler.EventRunner;

public class ThreadUtil {

    public static void runUI(Runnable runnable){
        EventRunner eventRunner = EventRunner.getMainEventRunner();
        EventHandler eventHandler = new EventHandler(eventRunner);
        eventHandler.postSyncTask(runnable);
    }

    public static void runWork(Runnable runnable){
        EventRunner eventRunner = EventRunner.create();
        EventHandler eventHandler = new EventHandler(eventRunner);
        eventHandler.postTask(runnable);
    }
}
